import os
import glob

# 打开文件并读取其内容
with open('/home/hsmy/桌面/GC2018.txt', 'r', encoding='utf-8') as file:
    # 使用readlines()方法按行读取文件，并将结果存储到列表中
    lines = file.readlines()

# 移除每行末尾的换行符
lines = [line.strip() for line in lines]

# for line in lines:
#     print(line)

# 指定要查找的目录和模式，使用 ** 进行递归查找
directory = '/media/hsmy/新加卷/20230619山西肿瘤'
files = []
# 递归遍历目录树
for dirpath, dirnames, filenames in os.walk(directory):
    for filename in filenames:
        # 将文件的完整路径加入列表
        files.append(filename)


# for filename in files:
#     print(filename)

# print(f"16T中共 {len(files)}")
# for file in files:
#     if file not in lines:
#         print(file)
#         # print(f"{file} 不在 gc2018 中")



# print(f"gc2018共 {len(lines)}")
for line in lines:
    if line not in files:
        print(line)
        # print(f"{line} 不在 16T盘 中")
